package j04zuoye;

import java.util.ArrayList;
import java.util.Arrays;

public class J136 {
    public static void main(String[] args) {

        ArrayList a = new ArrayList();
        //1-36
        //初始化数组
        int[][] arr = new int[6][6];
        int num = 1;
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                arr[i][j] = num++;
            }
        }
        System.out.println(Arrays.deepToString(arr));
        //求和
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                if (i == j || i + j == 5) {
                    sum += arr[i][j];
                }
            }
        }
        System.out.println("sum = " + sum);
    }
}
